<?php
include_once '../../connection/connection_database.php';
class UserLogin{
    function check_login($name, $pass){
        $sql = "SELECT user_name, user_pass FROM users WHERE user_name='".$name."' and user_pass='".$pass."'";
        $query = mysql_query($sql) or die(mysql_error());
        $data = mysql_num_rows($query);
        return $data;
    }
    
    function set_session($name, $value){
        $_SESSION[$name] = $value;
    }
    
    function set_cookie($name, $value, $time){
        setcookie($name, $value, $time);
    }
    
    function check_level($name){
        $sql = "SELECT user_id, level FROM users WHERE user_name='".$name."'";
        $query = mysql_query($sql) or die(mysql_error());
        return $query;
    }
}
?>
